package com.welsy.util.treeRenderer {

 import mx.controls.treeClasses.*;
 import mx.collections.*;
 import com.welsy.authoring.vo.course.pattern.CourseState;

 public class TreeCourseRenderer extends TreeItemRenderer 
 {

	// Define the constructor.
	public function TreeCourseRenderer() {
		super();
	}
	
	// Override the set method for the data property
	// to set the font color and style of each node.
	override public function set data(value:Object):void {
		if (value != null){
			super.data = value;
	
			if (CourseState.isPublish(TreeListData(super.listData).item.@state)) {
				setStyle("color", "#009900");
				setStyle("fontWeight", 'bold');
			}		
			else{
				setStyle("color", "black");
				setStyle("fontWeight", 'normal');
			}
			
			/* var tmp:XML = new XML(TreeListData(super.listData).item);
			if (tmp.localName() == "answer"){		
				if(TreeListData(super.listData).item.@weight == "100") {
					setStyle("color", "#009900");
				}
				else if (TreeListData(super.listData).item.@weight == "0") {
					setStyle("color", "#ff0000");
				}
				else {
					setStyle("color", "#ffcc00");
				}
			} */
		}
	}	
 }	
}